package com.zimin.cloud.web.controller.system;

import com.zimin.cloud.mine.pojo.system.business.MenuBO;
import com.zimin.cloud.system.api.IMenuFeign;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @author zimin
 * @since 2022/2/13 10:29 上午
 */
@RestController
@RequestMapping("/web/system/menu/api")
public class WebMenuController {

    @Autowired
    private IMenuFeign menuFeign;

    @GetMapping
    public Mono<Result> routes(MenuBO menuBO) {
        return Mono.just(menuFeign.routes(menuBO));
    }

    @GetMapping("/allRoutes")
    public Mono<Result> allRoutes(MenuBO menuBO) {
        return Mono.just(menuFeign.allRoutes(menuBO));
    }

    @PostMapping
    public Mono<Result> save(@RequestBody MenuBO menuBO) {
        return Mono.just(menuFeign.save(menuBO));
    }

    @PutMapping
    public Mono<Result> update(@RequestBody MenuBO menuBO) {
        return Mono.just(menuFeign.update(menuBO));
    }

    @DeleteMapping
    public Mono<Result> delete(@RequestParam(value = "idList") List<String> idList) {
        return Mono.just(menuFeign.delete(idList));
    }

}
